﻿Namespace Forms.Edit

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Public Class frmLessonDetails
        Inherits org.codegen.win.controls.frmBaseEdit

#Region "Designer"
        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then
                    components.Dispose()
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub

        Friend WithEvents UcLesson As ucLessonDetails

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer

        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.UcLesson = New IIC.ucLessonDetails()
            Me.SuspendLayout()
            '
            'UcLesson
            '
            Me.UcLesson.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange
            Me.UcLesson.Dock = System.Windows.Forms.DockStyle.Fill
            Me.UcLesson.isInitialized = False
            Me.UcLesson.Location = New System.Drawing.Point(0, 30)
            Me.UcLesson.ModelObject = Nothing
            Me.UcLesson.Name = "UcLesson"
            Me.UcLesson.Size = New System.Drawing.Size(573, 177)
            Me.UcLesson.TabIndex = 0
            '
            'frmLessonDetails
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(573, 229)
            Me.Controls.Add(Me.UcLesson)
            Me.Name = "frmLessonDetails"
            Me.ShowAdd = True
            Me.ShowDelete = True
            Me.ShowNavigationButtons = True
            Me.Text = "Lesson"
            Me.Controls.SetChildIndex(Me.UcLesson, 0)
            Me.ResumeLayout(False)
            Me.PerformLayout()

        End Sub


#End Region

#Region "Standard Code"

        Public Overrides Sub DeleteData()

            Dim mapper As LessonDBMapper = New LessonDBMapper()
            mapper.deleteByKey(Me.IdValue)

            'after delete, close the form
            'Note: do not set the dialog result here.  It is handled by the frmBaseEdit, ie do not call Me.DialogResult = Windows.Forms.DialogResult.None

        End Sub

        Public Overrides Sub LoadData()

            Me.UcLesson.ModelObject = New LessonDBMapper().findByKey(Me.IdValue)
            Me.UcLesson.loadData()
            Me.setRecordLoadedStatus(Me.IdValue)
        End Sub


        Public Overrides Function SaveData() As enumSaveDataResult

            If Me.ValidateChildren() Then
                Me.UcLesson.loadToObject()
                Dim db As New LessonDBMapper()
                db.save(Me.UcLesson.ModelObject)
                Return enumSaveDataResult.SAVE_SUCESS_AND_CLOSE
            Else
                Return enumSaveDataResult.SAVE_FAIL
            End If

        End Function

        Public Overrides Function dataChanged() As Boolean

            Return Me.UcLesson.hasChanges

        End Function


        ''' <summary>
        ''' On the load, we need to call "resetLastLoadedValues"
        ''' at the **end** of the method.  This call keeps track of the 
        ''' loaded data on the page, for the 'datachanged' functionality
        ''' </summary>
        Private Sub frm_Load(ByVal sender As Object, _
                                    ByVal e As System.EventArgs) Handles Me.Load

            '**** any code should go before "resetLastLoadedValues"


            '***** IMPORTANT: keep this call at the end of the procedure
            Call Me.UcLesson.resetLastLoadedValues()

        End Sub
#End Region

    End Class

End Namespace

